#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int a[N],vis[N],n;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int i,ans,sum=1,t=1;
    cin>>n;
    ans=n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    a[n+1]=0;
    i=2;
    while(a[i]==a[i-1])
        t++,i++;
    i++;
    for(i;i<=n+1;i++)
    {
        if(a[i]==a[i-1])
            sum++;
        else
        {
            if(t<=sum)
            {
                ans-=t;
                t=sum;
                sum=1;
            }
            else
            {
                ans-=sum;
                t=sum;
                sum=1;
            }
        }
    }
    cout<<ans;
    fclose(stdin);
    fclose(stdout);
    return 0;
}
